package com.sync.data.ievent.repository;


import com.sync.data.ievent.entity.Hcp;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.List;

/**
 * @author liquanchang
 */
@Repository
public interface HcpRepository extends JpaRepository<Hcp, String>, JpaSpecificationExecutor<Hcp> {


    public List<Hcp> findByAccCodeIn(List<String> accCodes);

    /**
     * 获取关系
     * @param accCodes 医生编号
     * @return BaseAccountRelation
     */
    List<Hcp> getHcpByAccCodeIn(Collection<String> accCodes);

    /**
     *
     * @param accCode
     * @return
     */
    Hcp getHcpByAccCode(String accCode);


    Hcp findByExternalId(String externalId);

    Hcp findByAccCode(String accCode);


    @Query(value = "select is_verified from pt_hcp_account where acc_code =:accCode" , nativeQuery = true)
    List<String> findPtByAccCode(String accCode);

}
